# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 15:54
# @Author  : qd
# @Email   : 1518603573@qq.com
# @File    : fiance_skd_page.py
# @Software: PyCharm
from pages.base_page import BasePage
from selenium.webdriver.common.by import By
"""收款单界面"""
class SkdPage(BasePage):
    url="/crm/index.php?m=finance&a=index&t=receivingorder"
    """添加收款单定位器"""
    skd_btn_add_locator = (By.CSS_SELECTOR, "body > div.container > div.row > div:nth-child(1) > div.pull-right > a")
    """选择收款单定位器"""
    skd_select_locator=(By.CSS_SELECTOR,"body > div.container > div.row > div:nth-child(2) > table > tbody > tr:nth-child(2) > td:nth-child(1) > input")
    """全部收款单定位器"""
    skd_check_all_locator = (By.ID, "check_all")
    """收款单删除按钮定位器"""
    skd_btn_delete_locator=(By.ID,"delete")
    """搜索收款单关键字输入框定位器"""
    skd_input_search_locator = (By.ID, "search")
    """收款单搜索按钮定位器"""
    skd_btn_search_locator = (By.CSS_SELECTOR, "#searchForm > ul > li:nth-child(4) > button")
    """skd_after_search_text"""
    skd_after_search_text_locator=(By.CSS_SELECTOR,"body > div.container > div.row > div:nth-child(2) > table > tbody > tr:nth-child(2) > td:nth-child(2) > a")
    """获取全部删除后页面上的元素"""
    skd_after_delete_text_locator=(By.CSS_SELECTOR,"body > div.container > div.row > div:nth-child(2) > table > tbody > tr > td")

    """点击添加收款单按钮"""
    def click_skd_btn_add(self):
        self.driver.find_element(*self.skd_btn_add_locator).click()
    """选中要删除的收款单"""
    def click_skd_select(self):
        self.driver.find_element(*self.skd_select_locator).click()
    """选中要删除的收款单"""
    def click_skd_check_all(self):
        self.driver.find_element(*self.skd_check_all_locator).click()
    """点击删除按钮"""
    def click_skd_btn_delete(self):
        self.driver.find_element(*self.skd_btn_delete_locator).click()
    """点击确定删除"""
    def click_skd_alert(self):
        self.driver.switch_to.alert.accept()
    """点击输入搜索关键词"""
    def input_skd_search(self,skd_keywords):
        self.driver.find_element(*self.skd_input_search_locator).send_keys(skd_keywords)
    """点击搜索按钮"""
    def click_skd_btn_search(self):
        self.driver.find_element(*self.skd_btn_search_locator).click()
    """"获取搜索后的文本"""
    def get_skd_after_search_text(self):
        return self.driver.find_element(*self.skd_after_search_text_locator).text.strip()
    """"获取全部删除后的文本"""
    def get_skd_after_delete_text(self):
        return self.driver.find_element(*self.skd_after_delete_text_locator).text.strip()
